# -*- coding: utf-8 -*-
import tensorflow as tf

def variable_summaries(name,var):

        # 将生成监控信息的操作放到同一个命名空间下查看
        with tf.name_scope(name+'summaries'):


            # 计算平均值
            mean=tf.reduce_mean(var)
            # 计算平均
            tf.summary.scalar('mean/'+name,mean)


            # 计算变量的标准差
            stddev=tf.sqrt(tf.reduce_mean(tf.sqrt(var-mean)))

            tf.summary.scalar('stdev/'+name,stddev)

            max=tf.reduce_max(var)
            tf.summary.scalar('max/'+name,max)

            min=tf.reduce_min(var)

            tf.summary.scalar('min/'+name,min)


            # 注释暂时不打上去
            tf.summary.histogram(name,var)

def image_summaries(name,var):

    with tf.name_scope('images'):

        tf.summary.image('image:'+name,var)